﻿@using Equation.Enterprise.Framework.Web.Model
@using ENail.Portal.Web.Models
@using MvcContrib.UI.Pager
@using MvcContrib.UI.Grid 
@using MvcContrib.Pagination 
@model GenericListViewModel<CustomerListViewItem>

@{
    ViewBag.Title = "Customer List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

		  <div id="container_home_main" >
            <div style="background-color:#edd2ca;width:645px;height:15px;text-align:center;padding:5px"> <font style="color:#5b362c;font-weight:bold">@ViewBag.Title</font> </div>
			<div id="container_content">
@using (Html.BeginForm())
    {
    <table>
        <tr>
            <td><input type="button" value="Add new customer" onclick="document.location='@Url.Action("Add")'" /></td>
            <td align="right" width="150px">Customer Name:</td>
            <td>@Html.TextBoxFor(x => x.Filter)</td>
            <td><input type="submit" value="Search" /></td>
        </tr>
    </table>

    <table>
        <tr>
            <td align="right">
                @Html.Pager((IPagination)Model.List).Link(page => Url.Action("List", new { page = page, filter = Model.Filter }))
            </td>
        </tr>
        <tr>
            <td>
                @Html.Grid(Model.List).Columns((column) =>
                                                {
                                                    column.For(x => Html.CheckBox("chkIsSelected", x.IsSelected))
                                                            .Named("");
                                                    column.For(x => x.FirstName)
                                                            .Named("First Name")
                                                            .Attributes(width => "100px");
                                                    column.For(x => x.LastName)
                                                            .Named("Last Name")
                                                            .Attributes(width => "100px");
                                                    column.For(x => x.Title)
                                                            .Named("Title")
                                                            .Attributes(width => "50px");
                                                    column.For(x => x.Address)
                                                            .Named("Address")
                                                            .Attributes(width => "200px");
                                                    column.For(x => x.Email)
                                                            .Named("Email")
                                                            .Attributes(width => "100px");
                                                    
                                                }
                                        ).Attributes(@class => "grid"
                                        ).HeaderRowAttributes(new Dictionary<string, object> { { "class", "gridheaderrow" } }
                                        ).RowAttributes(row => new Dictionary<string, object> { { "onclick", "document.location='" + Url.Action("Update", new { Id = row.Item.Id }) + "'"} })

                    @(Html.Telerik().Grid(Model.List)
                    .Name("Assignments")
                    .Columns(
                    columns =>
                        {
                            columns.Bound(o => o.FirstName).Width(200);
                            columns.Bound(o => o.LastName).Width(200);
                        } 
                    )
                    )
            </td>
        </tr>
        <tr>
            <td align="right">

            </td>
        </tr>
    </table>
        }
        </div>
	      </div>
          <div id="container_home_right">@{
            Html.RenderAction("InitializeTask");   
        }
</div>
        

        
